﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xrm.Solutions.FrameworkSample.Common;

namespace Xrm.Solutions.FrameworkSample.UnitTests
{
    [TestClass]
    public class SimpleStubUnitTest
    {
        [TestMethod]
        public void TestStubs()
        {
            //Setup
   
            IIdentityCheckService identityService 
                = new Xrm.Solutions.FrameworkSample.Common.Fakes.StubIIdentityCheckService()
            {
                RunCheckStringStringDateTimeString = (firstname, lastname, dob, address) =>
                    {
                        if (firstname == "Wael")
                            return 99;
                        else
                            return 60;
                    }
            };

            int score = identityService.RunCheck("Wael", "Anything", DateTime.Now, "Here");

            Assert.AreEqual(score, 99);

            score = identityService.RunCheck("Anything", "Anything", DateTime.Now, "Here");

            Assert.AreEqual(score, 60);
        }
    }
}
